import 'dart:developer';

import 'package:dio/dio.dart';
import 'package:sports_new/utils/log.dart';
import 'package:sports_new/utils/sp_utils.dart';

import 'request_header.dart';

class RequestInterceptor extends Interceptor {
  @override
  void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
    final auth = SpUtils.loginAuth;
    options.headers["Authorization"] = auth?.token;
    log("token = ${auth?.token}");
    RequestHeader.getIDFA();
    options.headers.addAll(RequestHeader.toJson());
    // dioLog.d(RequestHeader.toJson());
    // log("begin request========= ${options.uri}");
    super.onRequest(options, handler);
  }
}
